home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
2_8.lha
/
2_8
/
tstbadalign.h
< prev
Wrap
Text File
|
1993-08-08
|
781b
|
30 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ <tstbadalign.h>
/ this macro will test an assignment
/ to an address of each possible offset
/ for a given type
define tstbadalignments(type,typestr) \
{ \
type *ip; \
type ivar; \
int offset; \
cout << "Type = " << typestr << "\n"; \
for (offset = 0; \
offset < sizeof(type); \
offset++) \
{ \
cout << "\toffset = " << offset; \
ip = (type *)&foovar.a[offset]; \
if (!setjmp(jmpenv)) \
ivar = *ip; \
cout << "\n"; \
} \
}